<%-- 
    Document   : resuccess
    Created on : Nov 22, 2012, 10:12:52 AM
    Author     : BlueS
--%>

<%@page import="edu.fpt.common.Users"%>
<%@page import="edu.fpt.dal.BudgetDAL"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="pf"
          uri="/WEB-INF/tlds/pf_tag_lib.tld"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link href="Theme/style.css" media="screen" rel="stylesheet" type="text/css">
    </head>
    <pf:logo_tag/>

    <body>
    <center>
        <div class="box">

            <label>
                <%
                    if ("POST".equals(request.getMethod())) {
                        if (!BudgetDAL.checkUser(request.getParameter("username"))) {
                            if (request.getParameter("username") != "" && request.getParameter("pass") != "" && request.getParameter("gender") != "" && request.getParameter("emali") != "") {
                                Users entity = new Users(request.getParameter("username"), request.getParameter("pass"), request.getParameter("gender"), null, request.getParameter("emali"));
                                BudgetDAL.insertUser(entity);
                            } else {
                                response.sendRedirect("register.jsp");
                            }

                %> <h1>Success!</h1>
                <h3><a href="index.jsp">Click here to login and start using myPURSE!</a></h3><%
                } else {
                %> <h1>False</h1> 
                <h3><a href="index.jsp">Click here to login and start using myPURSE!</a></h3><%                            }
                    } else {
                        response.sendRedirect("index.jsp");
                    }
                %>

            </label>

        </div>

    </center>
</body>
</html>
